package thread.other;

/**
 * Created on 2020/6/5.
 */
class Person{
    int age;
    public Person(int age) {
        this.age = age;
    }
}
public class TestTransferValue {


    public static void main(String[] args) {
        int age = 30;
        changeInt(age);
        System.out.println(age);

        Person person = new Person(30);
        changePerson(person);
        System.out.println(person.age);

        String s = "30";
        changeStr(s);
        System.out.println(s);
    }

    private static void changeStr(String s) {
        s = "20";
    }

    private static void changePerson(Person person) {
        person.age = 20;
    }

    private static void changeInt(int age) {
        age = 20;
    }
}
